package com.esri.core.map;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.esri.core.internal.util.d;
import com.tencent.smtt.sdk.TbsVideoCacheTask;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class Legend {
    Bitmap a;
    String b;
    String c;
    String d;
    String e;
    ArrayList<String> f = new ArrayList<>();

    public Legend() {
    }

    public Legend(Bitmap bitmap, String str) {
        this.a = bitmap;
        this.b = str;
    }

    public Bitmap getImage() {
        return this.a;
    }

    public String getLabel() {
        return this.b;
    }

    public String getContentType() {
        return this.e;
    }

    public List<String> getValues() {
        return this.f;
    }

    public static Legend fromJson(JsonParser jsonParser) throws Exception {
        if (d.c(jsonParser)) {
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inPurgeable = true;
            Legend legend = new Legend();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if ("label".equals(currentName)) {
                    legend.b = jsonParser.getText();
                } else if (TbsVideoCacheTask.KEY_VIDEO_CACHE_PARAM_URL.equals(currentName)) {
                    legend.c = jsonParser.getText();
                } else if ("imageData".equals(currentName)) {
                    byte[] binaryValue = jsonParser.getBinaryValue();
                    if (binaryValue != null) {
                        legend.a = BitmapFactory.decodeByteArray(binaryValue, 0, binaryValue.length, options);
                    }
                } else if ("contentType".equals(currentName)) {
                    legend.e = jsonParser.getText();
                } else if ("values".equals(currentName)) {
                    if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
                        while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                            legend.f.add(jsonParser.getText());
                        }
                    }
                } else {
                    jsonParser.skipChildren();
                }
            }
            return legend;
        }
        return null;
    }
}
